/*
 * $Id: DefaultSessionFactory.java
 * Created on 2005-1-14 11:05:43
 */
package cn.donave.framework.hibernate.set;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import cn.donave.framework.hibernate.PersistentSessionFactory;

/**
 * 
 * @author Tim Du
 * @version $Revision: $
 */
public class DefaultSessionFactory implements PersistentSessionFactory {

	private SessionFactory sessionFactory;

	public DefaultSessionFactory() {
		try {
			// BasicServiceRegistry serviceRegistry = new
			// ServiceRegistryBuilder()
			// .buildServiceRegistry();
			// MetadataSources metadataSources = new MetadataSources(
			// serviceRegistry);
			// org.hibernate.metamodel.Metadata metadata = metadataSources
			// .buildMetadata();
			// sessionFactory = metadata.buildSessionFactory();
			Configuration cfg = new Configuration().configure();
			sessionFactory = cfg.buildSessionFactory();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

}